package dao.oc_boat_ice;

import java.util.ArrayList;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;


import entitybean.oc_boat.EntityBeanOc_Boat;
import entitybean.oc_boat_ice.EntityBeanOc_Boat_Ice;

public class DaoImpl_Oc_Boat_Ice extends HibernateDaoSupport implements Dao_Oc_Boat_Ice{
	public void Insert_Oc_Boat_Ice(EntityBeanOc_Boat_Ice e)
	{
		this.getHibernateTemplate().save(e);
	}
	public void Update_Oc_Boat_Ice(EntityBeanOc_Boat_Ice e)
	{
		this.getHibernateTemplate().update(e);
	}
	public void Delete_Oc_Boat_Ice(String id)
	{
		List<EntityBeanOc_Boat_Ice> list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Ice where del='OFF' and id in("+id+")");	
		for(int i=0;i<list.size();i++)
		{
			EntityBeanOc_Boat_Ice e=list.get(i);
			e.setDel("ON");
			this.getHibernateTemplate().update(e);
			
		}
	}
	
	@SuppressWarnings("unchecked")
	public List<EntityBeanOc_Boat_Ice> Find_EntityBeanOc_Boat_Ice()
	{
		List<EntityBeanOc_Boat_Ice> list=new ArrayList<EntityBeanOc_Boat_Ice>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Ice where del='OFF' ");
		return list;
	}
	public EntityBeanOc_Boat_Ice Find_EntityBeanOc_Boat_Ice(Integer id) {
		EntityBeanOc_Boat_Ice e=new EntityBeanOc_Boat_Ice();
		List<EntityBeanOc_Boat_Ice> list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Ice where id="+id);
		if(list.size()>0)
		{
			e=list.get(0);
		}
		return e;
	}
	public List<EntityBeanOc_Boat_Ice> Find_Oc_Boat_Ice_By_oc_boatkind_Active()
	{
		List<EntityBeanOc_Boat_Ice> list=new ArrayList<EntityBeanOc_Boat_Ice>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Ice where del='OFF'");
		return list;
		
	}
	public List<EntityBeanOc_Boat_Ice> Find_Oc_Boat_Ice_By_oc_boatkind(Integer oc_boatkind)
	{
		List<EntityBeanOc_Boat_Ice> list=new ArrayList<EntityBeanOc_Boat_Ice>();
		list=this.getHibernateTemplate().find("from EntityBeanOc_Boat_Ice where del='OFF' and oc_boatkind="+oc_boatkind);
		return list;	
		
		
	}
}
